Micron Document
Fox's Git Mirrors

Node / RFnexus / code.git / commits / 86f1020

Commit 86f1020d54ac0901142d1ed7a0006e329e71cbca


Parents : 455bc95
Author : Ahmet Inan <inan@aicodix.de>
Date : 2024-03-28T16:28:04+01:00

skip reduction with multiplication

Changes

1 files changed, 9 insertions(+), 6 deletions(-)


Diff

diff --git a/cauchy_prime_field_erasure_coding.hh b/cauchy_prime_field_erasure_coding.hh
index e481102..cd23a0f 100644
--- a/cauchy_prime_field_erasure_coding.hh
+++ b/cauchy_prime_field_erasure_coding.hh
@@ -73,15 +73,18 @@ struct CauchyPrimeFieldErasureCoding
}
void mac(const IO *a, PF b, int len, bool first, bool last)
{
- if (first) {
+ if (first && last) {
for (int i = 0; i < len; i++)
temp[i] = b * PF(a[i]);
+ } else if (first) {
+ for (int i = 0; i < len; i++)
+ temp[i] = mul(b, PF(a[i]));
} else if (last) {
for (int i = 0; i < len; i++)
- temp[i] = reduce(add(temp[i], b * PF(a[i])));
+ temp[i] = reduce(add(temp[i], mul(b, PF(a[i]))));
} else {
for (int i = 0; i < len; i++)
- temp[i] = add(temp[i], b * PF(a[i]));
+ temp[i] = add(temp[i], mul(b, PF(a[i])));
}
}
void mac_sub(IO *c, const IO *a, PF b, IO s, int len, bool first, bool last)
@@ -92,13 +95,13 @@ struct CauchyPrimeFieldErasureCoding
c[i] = (b * PF(a[i] == s ? v : a[i]))();
} else if (first) {
for (int i = 0; i < len; i++)
- temp[i] = b * PF(a[i] == s ? v : a[i]);
+ temp[i] = mul(b, PF(a[i] == s ? v : a[i]));
} else if (last) {
for (int i = 0; i < len; i++)
- c[i] = reduce(add(temp[i], b * PF(a[i] == s ? v : a[i])))();
+ c[i] = reduce(add(temp[i], mul(b, PF(a[i] == s ? v : a[i]))))();
} else {
for (int i = 0; i < len; i++)
- temp[i] = add(temp[i], b * PF(a[i] == s ? v : a[i]));
+ temp[i] = add(temp[i], mul(b, PF(a[i] == s ? v : a[i])));
}
}
int find_unused(int block_len)

Served by rngit 1.4.1 - Generated in 0.02s